import React, { useEffect } from 'react'
import {useSelector,useDispatch} from "react-redux"
import {incrementAC,decrementAC} from "../redux/actions/countAction"
import {Link} from "react-router-dom"

export default function Register() {
  //state是仓库完整数据
  const storeData = useSelector(state=>{
    return state.countRD
  })
  const dispatch = useDispatch()
  useEffect(()=>{
    console.log(storeData);
  },[])
  const changeCount = (value)=>{
    dispatch(incrementAC(value))
  }
  return (
    <div>
      <h2>Register</h2>
      <p>{storeData.count}</p>
      <button onClick={()=>changeCount(11)}>+</button>
      <button>-</button>
      <Link to="/login">登录</Link>
    </div>
  )
}
